//
//  Service+SpecialSales.m
//  gskin
//
//  Created by fengyn on 15/12/24.
//  Copyright © 2015年 lexingsoft. All rights reserved.
//

#import "Service+SpecialSales.h"

@implementation ServiceManager(SpecialSales)

///分页查询特惠活动
+ (void)getAllSpecialSalesWithPageIndex:(NSUInteger)pageIndex success:(void(^)(NSDictionary *data)) success failure:(void(^)(NSDictionary *data)) failure
{
    NSString *path = @"/specialsales/public/page";
    const int countPer=20;
    NSDictionary *parameterDict=@{@"start":@(pageIndex*countPer),
                                  @"length":@(countPer),
                                  @"isFinish":@"N"};
    [NetworkClient getRequest:path parameters:parameterDict NeedPrompt:YES success:^(id dataObject) {
        success(dataObject);
    } failure:^(id resultDict) {
        failure(resultDict);
    }];
}

///根据ID获取特惠活动详细信息
+ (void)getSpecialSalesDetailWithId:(NSString *)newsId success:(void(^)(NSDictionary *data)) success failure:(void(^)(NSDictionary *data)) failure
{
    NSString *path = [NSString stringWithFormat:@"%@/%@",@"/specialsales/public",newsId];
    NSDictionary *parameterDict=nil;
    [NetworkClient getRequest:path parameters:parameterDict NeedPrompt:YES success:^(id dataObject) {
        success(dataObject);
    } failure:^(id resultDict) {
        failure(resultDict);
    }];
}

///分页查询我已购买的特惠活动
+ (void)getMySpecialSalesWithPageIndex:(NSUInteger)pageIndex success:(void(^)(NSDictionary *data)) success failure:(void(^)(NSDictionary *data)) failure
{
    NSString *path = @"/specialinstance/public/page";
    const int countPer=20;
    NSDictionary *parameterDict=@{@"start":@(pageIndex*countPer),
                                  @"length":@(countPer),};
    [NetworkClient getRequest:path parameters:parameterDict NeedPrompt:YES success:^(id dataObject) {
        success(dataObject);
    } failure:^(id resultDict) {
        failure(resultDict);
    }];
}
@end
